CC=mpicc
CXX=mpicxx
LD=mpiCC
FC=mpif77

CFLAGS =    -g -Wall -O3
FFLAGS =    
LDFLAGS =	-lz -lgfortran

all: lib/libcrf.a

lib/libcrf.a: \
	build/data.o \
	build/lbfgs_wrapper.o build/lbfgs.o \
	build/util.o build/crf_minable.o build/crf_learn.o \
	build/gzstream.o build/bp.o build/flat_minable.o
	ar rc $@ $^
	ranlib $@

build/%.o: %.cpp
	${CXX} $(CFLAGS) -c $< -o $@

build/%.o: %.c
	${CC} $(CFLAGS) -c $< -o $@

build/%.o: %.f
	$(FC) $(FFLAGS) -c $< -o $@

getopt: getopt.h getopt.c getopt1.c
	$(CC) $(CFLAGS) -c getopt.c getopt1.c -o build/getopt.o

depend:
	makedepend -- $(CFLAGS) -- -p "build/" -Y *.cpp *.c

clean:
	rm -f build/*.o
	rm -f lib/*.a

clobber: clean
	rm -f bin/crf
# DO NOT DELETE

build/bp.o: bp.h data.h sparse_array.h sparse_matrix.h
build/crf_classifier.o: crf_classifier.h param.h sparse_array.h data.h
build/crf_classifier.o: sparse_matrix.h util.h
build/crf_learn.o: crf_learn.h param.h data.h sparse_array.h sparse_matrix.h
build/crf_learn.o: crf_minable.h lbfgs.h util.h flat_minable.h
build/crf_minable.o: crf_minable.h param.h data.h sparse_array.h
build/crf_minable.o: sparse_matrix.h lbfgs.h util.h bp.h
build/data.o: data.h sparse_array.h sparse_matrix.h util.h param.h gzstream.h
build/flat_minable.o: flat_minable.h crf_minable.h param.h data.h
build/flat_minable.o: sparse_array.h sparse_matrix.h lbfgs.h util.h
build/gzstream.o: gzstream.h
build/util.o: util.h sparse_array.h param.h
build/lbfgs_wrapper.o: lbfgs.h
